#include<iostream>
using namespace std;
class CPolygon{
protected:
	int width;
	int height;
public:
	void SetValues(int a,int b);
};
void CPolygon::SetValues(int a,int b){
	width=a;
	height=b;
}
class Coutput{
	public:
	void writeln(int i);
};
void Coutput::writeln(int i){
	cout<<i<<endl;
}
class CRectangle:public CPolygon,public Coutput{
public:
	int area();
};
int CRectangle::area(){
	return (width*height);
}
class CTriangle:public CPolygon,public Coutput{
public:
	int area();
};
int CTriangle::area(){
	return (width*height/2);
}
int main(){
	CRectangle rect;
	CTriangle trgl;
	rect.SetValues(4,5);
	trgl.SetValues(4,5);
	rect.writeln(rect.area());
	trgl.writeln(trgl.area());
	system("pause");
	return 0;
}